package com.meituan.catering.management.product.biz.model;

import com.meituan.catering.management.common.model.biz.BaseBO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import java.math.BigDecimal;
import java.util.LinkedList;
import java.util.List;

/**
 * 商品BO定义 含加料组 方法组
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ProductBO extends BaseBO {
    /**
     * 商品名称
     */
    private String name;
    /**
     * 商品价格
     */
    private BigDecimal unitPrice;
    /**
     * 商品价格单位
     */
    private String unitOfMeasure;
    /**
     * 最小售卖量
     */
    private BigDecimal minSalesQuantity;
    /**
     * 增长量
     */
    private BigDecimal increaseSalesQuantity;
    /**
     * 菜品描述信息
     */
    private String description;
    /**
     * 菜品状态
     */
    private Integer enabled;

    @ApiModelProperty("做法组")
    private final List<MethodGroup> methodGroups = new LinkedList<>();

    @ApiModelProperty("加料组")
    private final List<AccessoryGroup> accessoryGroups = new LinkedList<>();

    @Data
    @ApiModel("商品做法组")
    public static class MethodGroup {

        @ApiModelProperty("做法组名")
        private String name;

        @ApiModelProperty("做法项列表")
        private final List<Option> options = new LinkedList<>();

        @Data
        @ApiModel("做法项")
        public static class Option {

            @ApiModelProperty("物理ID")
            private Long id;

            @ApiModelProperty("名称")
            private String name;

        }
    }

    @Data
    @ApiModel("商品加料组")
    public static class AccessoryGroup {

        @ApiModelProperty("物理ID")
        private Long id;

        @ApiModelProperty("加料组名")
        private String name;

        @ApiModelProperty("加料项列表")
        private final List<Option> options = new LinkedList<>();

        @Data
        @ApiModel("加料项")
        public static class Option {

            @ApiModelProperty("物理ID")
            private Long id;

            @ApiModelProperty("名称")
            private String name;

            @ApiModelProperty("单价")
            private BigDecimal unitPrice;

            @ApiModelProperty("计量单位")
            private String unitOfMeasure;

        }
    }


}